<template>
	<view>
		<view class="my-assets-middle">
			<view url="/pages/personal/my-assets/my-assets" class="middle-left">
				<text class="textone">总金额(元)</text><br>
				<text class="texttwo">{{sumOverAllBalance}}</text><br>
				<view class="textthree">昨日收益 <text class="assets-text">{{todaySumEarning}}</text></view>
			</view>
			<view class="middle-right">
				<view class="textthree">累计收益 <text class="assets-text">{{sumEarning}}</text></view>
			</view>
		</view>
		
		<!-- 显示订单 -->
		<view  class="exclusive-item" v-for="item in memberCurrent"  v-if="item.overAllBalance>0" :key='item.id'>
			<view class="item-titll">
				<view class="">{{item.codeName}}</view>
				<view class="detals" @click="currentList(item.overAllBalance,item.todayEarnings,item.totalEarnings,item.currentCode)">查看详情 ></view>
			</view>
			<view class="itemboxs">
				<view class="last-item">
					<text class="text1-1">金额(元)</text><br>
					<text class="text1-2">{{item.overAllBalance}}</text>
				</view>
				<view class="last-item">
					<text class="text1-1">昨日收益(元)</text><br>
					<text style="color:#999999;" class="text1-2">{{item.todayEarnings}}</text>
				</view>
				<view class="last-item">
					<text class="text1-1">累计收益(元)</text><br>
					<text style="color: red;" class="text1-2">{{item.totalEarnings}}</text>
				</view>
			</view>
		</view>
		<!-- 没有订单 -->
		<view v-if="sumOverAllBalance==0" class="none">
			没有任何订单
		</view>
	</view>
</template>

<script>
	import {createNamespacedHelpers} from "vuex"
		const {mapActions} = createNamespacedHelpers("payCurrent");
		const {mapState:userMapState} = createNamespacedHelpers('UserInfor');
	export default {
		data() {
			return {
				sumOverAllBalance:'0.00', //总金额
				sumEarning:'0.00'  ,//累计收益
				todaySumEarning:'0.00',  //昨日收益
				memberCurrent:[]  //购买记录
			}
		},
		onLoad(){
			this.myGetCurrentAssent()
		},
		computed:{
			...userMapState(['userData'])
		},
		methods: {
			...mapActions(['getCurrentAssent']),
			//跳转详情页面
			currentList(a,b,c,d){
				console.log(a,b,c,d);
				uni.navigateTo({
					url:'../../../currentList/currentList?overAllBalance='+ a +
							'&todayEarnings=' + b +
							'&totalEarnings=' + c +
							'&code='+d
				})
			},
			//获取活期资产详情
			async myGetCurrentAssent(){
				const list = await this.getCurrentAssent({
					userName:this.userData.username
					})
				console.log(list);
				this.sumEarning=list.data.sumEarning
				this.todaySumEarning=list.data.todaySumEarning
				this.memberCurrent=list.data.memberCurrentAccounts
				this.sumOverAllBalance=list.data.sumOverAllBalance
			}
		}
	}
</script>

<style>

.my-assets-middle {
		width: 100%;
		height: 190rpx;
		display: flex;
		flex-grow: 1;
		/* border: 1px solid red; */
		margin-bottom: 20rpx;
	}

	.middle-left {
		width: 300rpx;
		height: 160rpx;
		/* border: 1rpx solid red; */
		padding-top: 20rpx;
		padding-left: 40rpx;
	}

	.middle-right {
		width: 300rpx;
		height: 80rpx;
		/* border: 1rpx solid red; */
		padding-top: 100rpx;
		padding-left: 40rpx;
	}

	.textone {
		color: #333333;
		font-size: 26rpx;
		font-family: PingFang SC;
	}

	.texttwo {
		color: #333333;
		font-size: 35rpx;
		font-family: PingFang SC;
		font-weight: bold;
	}

	.textthree {
		font-family: PingFang SC;
		font-size: 28rpx;
		color: #999999;
		margin-top: 17rpx;
	}
	.assets-text{
		font-family: PingFang SC;
		font-size: 32rpx;
		color: #666666;
		margin-left: 15rpx;
	}
	
	
	
	
	/* 购买产品 */
	.exclusive-item {
		width: 700rpx;
		height: auto;
		background: #FFFFFF;
		box-shadow: 0px 0px 24rpx rgba(0, 0, 0, 0.06);
		padding: 20rpx;
		border-radius: 24rpx;
		margin: 10rpx auto;
	}
	
	.itemboxs{
		width: 100%;
	}
	
	.item-titll{
		width: 100%;
		margin: 0rpx auto 20rpx;
		/* border: 1px solid red; */
		font-size: 28rpx;
		color: #333333;
		font-family: PingFang SC;
		display: flex;
		justify-content: space-between;
	}
	.detals{
		width: 150rpx;
		background-color: #EBEEF5;
		text-align: center;
		border-radius: 20rpx;
		font-size: 24rpx;
	}
	.none{
		padding-top: 20rpx;
		padding-left: 40rpx;
		border-top: 2rpx solid #999999;
	}
	.itemboxs{
		width: 100%;
		margin: 0rpx auto;
		/* border: 1px solid red; */
		display: flex;
	}
	.last-item{
		width: 100%;
		/* border: 1px solid red; */
		text-align: center;
	}
	.text1-1{
		font-size: 24rpx;
		font-family: PingFang SC;
		color: #666666;
	}
	.text1-2{
		font-size: 24rpx;
		color: #333333;
	}
</style>
